package com.bm.server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bm.server.dto.RoomUerDto;
import com.bm.server.entity.RoomUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * YoungMan, may the force be with you.
 *
 * @Author: 吃个小布丁吧
 * @Date: 2022/07/20/21:17
 */
public interface RoomUserDao extends BaseMapper<RoomUser> {
    @Select("select roomid,nameid,type,userhead from t_roomuser where roomid = #{roomid} order BY  roomid")
    //R select(int roomid);
    List<RoomUerDto> select(int roomid);
//    @Insert("insert into t_roomuser(roomid,nameid,type) values(#{roomid},#{nameid},#{type})")
    @Select("select * from t_roomuser where roomid=#{roomid} and nameid=#{uid} ")
    List<RoomUser> selectAll(@Param("roomid") Integer roomid, @Param("uid") Integer uid);
    @Select("SELECT * FROM t_roomuser where roomid=#{roomid} ORDER BY RAND() LIMIT 2")
    List<RoomUser> getTwo(Integer roomid);
}
